
clear all
set more off
global dir "C:\code"
global dir2 "C:\code\output" 


******************************************************************************
******************************** Figures  ********************************
******************************************************************************

	
***************Figure 3. Policy effect on credit card spending, debt, and delinquencies: Event study estimates*******************************

cd "$dir"
use figure3data.dta,clear
cd "$dir2"

graph twoway (connect beta_purchases_total yearmth)(rline hibeta_purchases_total lobeta_purchases_total yearmth, lp(dash)),  ///
legend(pos(6) row(1) label(1 "Credit Card Spending") label(2 "95% CI")) xlabel(605(6)635) ///
title("Credit Card Spending")xtitle("Month")ytitle("Lira")xscale(titlegap(3))yline(0)xline(611 617 623 629 635)
graph export figure3_panelA.png,replace


graph twoway (connect beta_debt_total yearmth)(rline hibeta_debt_total lobeta_debt_total yearmth, lp(dash)),  ///
legend(pos(6) row(1) label(1 "Credit Card Debt") label(2 "95% CI")) xlabel(605(6)635) ///
title("Credit Card Debt")xtitle("Month")ytitle("Lira")xscale(titlegap(3))yline(0)xline(611 617 623 629 635)
graph export figure3_panelB.png,replace


graph twoway (connect beta_delinquent60 yearmth)(rline hibeta_delinquent60 lobeta_delinquent60 yearmth, lp(dash)),  ///
legend(pos(6) row(1) label(1 "Delinquency") label(2 "95% CI")) xlabel(605(6)635) ///
title("Delinquency")xtitle("Month")ytitle("Lira")xscale(titlegap(3))yline(0)xline(611 617 623 629 635)
graph export figure3_panelC.png,replace

***************Figure 4. Persistent of Payment Behavior*******************************
cd "$dir"
use figure4Adata.dta,clear
cd "$dir2"
graph twoway (scatter mean_percent mean_L1percent if L1treat_d==0,msymbol(O)mcolor(blue))(scatter mean_percent mean_L1percent if L1treat_d==1,msymbol(D)mcolor(green)) ///
(line treat_d treat_d,lcolor(red)),legend(pos(6) row(1) label(1 "Above minimum payment") label(2 "Below minimum payment") label (3 "45 degree line")) ///
title("Persistence of Payment Behavior")xtitle("Lagged %Paid")ytitle("%Paid") xlabel(0(0.2)1)ylabel(0(0.2)1)
graph export figure4_panelA.png , replace

	
cd "$dir"
use figure4Bdata.dta,clear
cd "$dir2"

graph twoway (connect percent_paid month if treat==0,msymbol(O))(connect percent_paid month if treat==1,msymbol(D)), ///
legend(pos(6) row(2) label(1 "Above minimum payment") label(2 "Below minimum payment")) ///
title("Persistence of Payment Behavior")xtitle("Month")ytitle("%Paid")xlabel(1(1)8)
graph export figure4_panleB.png, replace
	
	

***************Figure 5. MP treatment effect on credit card spending and debt*******************************


cd "$dir"
use figure5data.dta,clear
cd "$dir2"

graph twoway (connect beta_purchases_total yearmth)(rline hibeta_purchases_total lobeta_purchases_total yearmth, lp(dash)),  ///
legend(pos(6) row(1) label(1 "Credit Card Spending") label(2 "95% CI")) xlabel(623(6)635) ///
title("Credit Card Spending")xtitle("Month")ytitle("Lira")xscale(titlegap(3))yline(0)xline(623 629 635)
graph export figure5_panelA.png,replace


graph twoway (connect beta_debt_total yearmth)(rline hibeta_debt_total lobeta_debt_total yearmth, lp(dash)),  ///
legend(pos(6) row(1) label(1 "Credit Card Debt") label(2 "95% CI")) xlabel(623(6)635) ///
title("Credit Card Debt")xtitle("Month")ytitle("Lira")xscale(titlegap(3))yline(0)xline(623 629 635)
graph export figure5_panelB.png,replace


******************Figure 6: Bunching around required minimum payment ratios***************
cd "$dir"
use Pseudodata_main.dta, clear
cd "$dir2"

*Main figure
hist percent_paid if percent_paid<0.55 & minpay20==1,start(-0.005)width(0.01)xlabel(0(0.05)0.55)xtitle("%Paid")title("Minimum Payment: 20%")
graph export figure6_panelA.png,replace
hist percent_paid if percent_paid<0.55 & minpay22==1,start(-0.005)width(0.01)xlabel(0(0.05)0.55)xtitle("%Paid")title("Minimum Payment: 22%")
graph export figure6_panelB.png,replace
hist percent_paid if percent_paid<0.55 & minpay25==1,start(-0.005)width(0.01)xlabel(0(0.05)0.55)xtitle("%Paid")title("Minimum Payment: 25%")
graph export figure6_panelC.png,replace
hist percent_paid if percent_paid<0.55 & minpay28==1,start(-0.005)width(0.01)xlabel(0(0.05)0.55)xtitle("%Paid")title("Minimum Payment: 28%")
graph export figure6_panelD.png,replace
hist percent_paid if percent_paid<0.55 & minpay30==1,start(-0.005)width(0.01)xlabel(0(0.05)0.55)xtitle("%Paid")title("Minimum Payment: 30%")
graph export figure6_panelE.png,replace




***************Figure 7: Delinquency across debt burden quintiles*******************************
cd "$dir"
use figure7data.dta,clear
cd "$dir2"
graph twoway (connect beta3 number)(rcap hibeta3 lobeta3 number), ///
legend(pos(6) row(1) label(1 "Delinquency") label(2 "95% CI"))xlabel(1 "1"  2.5 "2" 4 "3" 5.5 "4" 7 "5") ///
title("Heterogeneous Effects by Debt Burden")xtitle("Debt Burden")ytitle("Coefficients")xscale(range(1 7.5)titlegap(3))yline(0)
graph export figure7.png , replace

	


******************Figure A.3 Bunching around required minimum payment ratios over time***************
cd "$dir"
use Pseudodata_main.dta, clear
cd "$dir2"

label define group 20 "Minimum Payment: 20%" 22 "Minimum Payment: 22%" 25 "Minimum Payment: 25%" 28 "Minimum Payment: 28%" 30 "Minimum Payment: 30%" 
label value minpay_rate group
hist percent_paid if percent_paid<0.55 & credit_limit<=5000,start(-0.005)width(0.01)xlabel(0(0.05)0.55)xtitle("%Paid")by(minpay_rate,col(1)note(""))
graph export figureA3_panelA.png,replace
hist percent_paid if percent_paid<0.55 & credit_limit>5000 & credit_limit<=15000,start(-0.005)width(0.01) xlabel(0(0.05)0.55)xtitle("%Paid")by(minpay_rate,col(1)note(""))
graph export figureA3_panelB.png,replace
hist percent_paid if percent_paid<0.55 & credit_limit>15000 & credit_limit<=20000,start(-0.005)width(0.01) xlabel(0(0.05)0.55)xtitle("%Paid")by(minpay_rate,col(1)note(""))ylabel(0(10)20)
graph export figureA3_panelC.png,replace
hist percent_paid if percent_paid<0.55 & credit_limit>20000,start(-0.005)width(0.01) xlabel(0(0.05)0.55)xtitle("%Paid")by(minpay_rate,col(1)note(""))ylabel(0(10)20)
graph export figureA3_panelD.png,replace

	

